<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      body {
        margin: 30px;
      }

      /* 入场动画（尾部减速） */
      .slide-fade-enter-active {
        transition: all 3s linear;
      }

      /* 出场动画（先减速再加速——贝塞尔速率曲线） */
      .slide-fade-leave-active {
        transition: all 3s cubic-bezier(1, 0.2, 0.8, 1);
      }

      /* 进入之初与离开之末：右侧透明 */
      .slide-fade-enter-from,
      .slide-fade-leave-to {
        transform: translateX(1000px);
        opacity: 0;
      }

    </style>
    <script src="./vue.global.js"></script>
  </head>

  <body>
    <div id="demo">
      <button @click="show = !show">Toggle render</button>

      <transition name="slide-fade">
        <p v-if="show">hello</p>
      </transition>
    </div>

    <script>
      const Demo = {
        data() {
          return {
            show: true,
          };
        },
      };

      Vue.createApp(Demo).mount("#demo");
    </script>
  </body>
</html>
